define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {
        index: function () {
            // 初始化表格参数配置
            Table.api.init({
                extend: {
                    index_url: 'wddj/finance/income_expenditure/index' + location.search,
                    table: 'wddj_income_expenditure',
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                pk: 'id',
                sortName: 'id',
                fixedColumns: true,
                fixedRightNumber: 1,
                columns: [
                    [
                        {field: 'id', title: __('Id')},
                        {field: 'order_no', title: __('Order.order_no'), operate: 'LIKE'},
                        {field: 'city', title: __('Order.city'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
                        {field: 'payer.name', title: __('Payer.name'), operate: false},
                        {field: 'payer.mobile', title: __('Payer.mobile'), operate: false},
                        {field: 'platform_commission', title: __('Order.platform_commission'), operate:'BETWEEN'},
                        {field: 'driver_commission', title: __('Order.driver_commission'), operate:'BETWEEN'},
                        {field: 'actual_amount', title: __('Order.actual_amount'), operate:'BETWEEN'},
                        {field: 'pay_time', title: __('Payments.pay_time'), operate:false},
                    ]
                ]
            });

            // 为表格绑定事件
            Table.api.bindevent(table);
        },
        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});
